package org.csu.linkgame.service.ClassForDoubleGame;

import java.io.*;
import java.net.Socket;

public class SocketThread1 implements Runnable{
    public Socket socket;

    public SocketThread1(Socket socket){
        this.socket = socket;
    }

    @Override
    public void run() {
        ObjectOutputStream os = null;
        ObjectInputStream is = null;
        while(true){
            if(doubleGameData.sendPathFlag == 1){
                try {
                    os = new ObjectOutputStream(this.socket.getOutputStream());
                    os.writeObject(doubleGameData.path);
                    doubleGameData.sendPathFlag = 0;
                    os.flush();
                }catch (Exception o){
                    o.printStackTrace();
                }
            }
        }
        /*try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            PrintWriter pw = new PrintWriter(socket.getOutputStream());
            while(true){
                String str = br.readLine();
                pw.println(str);
                pw.flush();
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }*/

    }
}
